from app.db.models.alert_groups import AlertGroup
from app.db.models.users import User


class CloseAlertGroup:

    def service(self, username_list):
        users = User.objects.filter(username__in=username_list)
        uid_ids = [user.pk for user in users]
        AlertGroup.objects(uid__in=uid_ids).update(enable=False)
